package com.twu.biblioteca.ui.menus.items;

import com.twu.biblioteca.library.Library;
import com.twu.biblioteca.ui.menus.AbstractMenu;
import com.twu.biblioteca.users.UserAccountsManager;

/**
 * @author Alvi Jonathan Sait
 */
public abstract class AbstractMenuItem {

    private final String optionName;

    protected AbstractMenuItem(String optionName) {
        this.optionName = optionName;
    }

    /**
     * Determines if this menu item is viewable by the user. By default all menu items is viewable by all users.
     */
    public boolean isViewableByActiveUser(UserAccountsManager userAccountsManager) {
        return true;
    }

    @Override
    public String toString() {
        return this.optionName;
    }

    public abstract AbstractMenu handleAction(Library library);
}
